package com.example.petplanet.util;

import com.alibaba.fastjson2.JSON;
import com.example.petplanet.domain.Message;


import java.time.LocalDateTime;


public class MessageUtils {


    public static String getResultMessage(long toUserId, long fromUserId, Object message, Message.Type type) {
        Message resultMessage=new Message(toUserId,false,fromUserId,message,LocalDateTime.now(), type);
        return JSON.toJSONString(resultMessage);
    }

    public static String getResultMessage(Message resultMessage){
        return JSON.toJSONString(resultMessage);
    }

    public static String getSystemResultMessage(Object message){
        Message resultMessage=new Message(-1,true,-1,message,LocalDateTime.now(), Message.Type.TEXT);
        return JSON.toJSONString(resultMessage);
    }











}
